//
//  ThreeCell.m
//  WE
//
//  Created by 要帅气的生活 on 15/11/18.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "ThreeCell.h"
#import "SDCycleScrollView.h"
#import "Size.h"
#import "ShufflingFigureDetailsViewController.h"
#import "SingletonStoreSimpleData.h"
@interface ThreeCell ()<SDCycleScrollViewDelegate>

@end

@implementation ThreeCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        //self.arr = [NSMutableArray arrayWithArray:[SingletonStoreSimpleData shareViewController].array];
        SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, WindowWidth,110) imagesGroup:[SingletonStoreSimpleData shareViewController].array];
        cycleScrollView.infiniteLoop = YES;
        cycleScrollView.delegate = self;
        cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
        [self addSubview:cycleScrollView];
        cycleScrollView.autoScrollTimeInterval = 4.0;
    }
    return self;
}
- (UIViewController *)viewController{
    for (UIView *next = [self superview]; next; next = next.superview) {
        UIResponder *nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)nextResponder;
        }
    }
    return nil;
}
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
{
    NSLog(@"---点击了第%ld张图片", (long)index);
    ShufflingFigureDetailsViewController *shu = [ShufflingFigureDetailsViewController new];
    shu.view.backgroundColor = [UIColor whiteColor];
    [[self viewController].navigationController pushViewController:shu animated:YES];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
